package com.nuoniu.sibanyun.mapper.production;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nuoniu.sibanyun.entity.production.VProductionPickReturnMain;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 生产领退补料单主表 Mapper 接口
 * </p>
 *
 * @author 小啊刚
 * @since 2021-01-15
 */
public interface VProductionPickReturnMainMapper extends BaseMapper<VProductionPickReturnMain> {

    @Select("select voucher_code from ma_picking_return_rep where company_id=#{companyId} and date_format(create_date, #{dateStr})=date_format(now(), #{dateStr}) AND data_source = #{dataSource} order by create_date desc limit 1")
    String getNewestCode(Integer companyId, String dateStr,String dataSource);
    @Select("SELECT COUNT(1) FROM ma_picking_return_rep WHERE source_voucher_id = #{workMainId}")
    boolean isHaveFromWorkMainId(Long workMainId);

}
